<Project>
  <PropertyGroup>
    <DisableArcadeTestFramework>true</DisableArcadeTestFramework>
    <!-- Enabling this rule will cause build failures on undocumented public APIs.
         We cannot add it in eng/Versions.props because src/coreclr does not have access to UseCompilerGeneratedDocXmlFile, which ensures
         we only enable it in specific projects. so to avoid duplicating this property in coreclr, we can first scope it to src/libraries.
         This property needs to be declared before the ..\..\Directory.Build.props import. -->
    <SkipArcadeNoWarnCS1591>true</SkipArcadeNoWarnCS1591>

    <!-- Prevent native-binplace.proj from being treated as a source project, to avoid importing illink targets
         and thereby avoid hitting a static graph restore bug: https://github.com/dotnet/runtime/issues/92194 -->
    <IsSourceProject Condition="'$(MSBuildProjectFile)' == 'native-binplace.proj'">false</IsSourceProject>
  </PropertyGroup>

  <Import Project="..\..\Directory.Build.props" />

  <PropertyGroup>
    <BeforeTargetFrameworkInferenceTargets>$(RepositoryEngineeringDir)BeforeTargetFrameworkInference.targets</BeforeTargetFrameworkInferenceTargets>
    <GeneratePlatformNotSupportedAssemblyHeaderFile>$(RepositoryEngineeringDir)LicenseHeader.txt</GeneratePlatformNotSupportedAssemblyHeaderFile>
  </PropertyGroup>

  <ItemGroup>
    <!-- Projects which are manually built. -->
    <ProjectExclusions Include="$(CommonTestPath)System\Net\Prerequisites\**\*.csproj" />
  </ItemGroup>

  <Import Project="NetCoreAppLibrary.props" />
  <Import Project="$(RepositoryEngineeringDir)testing\linker\trimmingTests.props" Condition="'$(IsPublishedAppTestProject)' == 'true'" />

  <PropertyGroup>
    <!-- Default any assembly not specifying a key to use the Open Key -->
    <StrongNameKeyId>Open</StrongNameKeyId>
    <!-- Microsoft.Extensions projects have a separate StrongNameKeyId -->
    <StrongNameKeyId Condition="$(MSBuildProjectName.StartsWith('Microsoft.Extensions.'))">MicrosoftAspNetCore</StrongNameKeyId>
    <!-- We can't generate an apphost without restoring the targeting pack. -->
    <UseAppHost>false</UseAppHost>
    <EnableDefaultItems>false</EnableDefaultItems>
    <!-- Libraries packages use the incremental servicing infrastructure. -->
    <PackageUseIncrementalServicingVersion>true</PackageUseIncrementalServicingVersion>
  </PropertyGroup>

  <!-- Language configuration -->
  <PropertyGroup>
    <GenFacadesIgnoreBuildAndRevisionMismatch>true</GenFacadesIgnoreBuildAndRevisionMismatch>
    <!-- Disable analyzers for tests and unsupported projects -->
    <RunAnalyzers Condition="'$(IsTestProject)' != 'true' and '$(IsSourceProject)' != 'true' and '$(IsGeneratorProject)' != 'true'">false</RunAnalyzers>
    <!-- Enable documentation file generation by the compiler for all libraries except for vbproj. -->
    <GenerateDocumentationFile Condition="'$(IsSourceProject)' == 'true' and '$(MSBuildProjectExtension)' != '.vbproj'">true</GenerateDocumentationFile>
    <CLSCompliant Condition="'$(CLSCompliant)' == '' and '$(IsTestProject)' != 'true' and '$(IsTestSupportProject)' != 'true'">true</CLSCompliant>
    <!-- Nullability is enabled by default except for test projects, which instead default to annotations. -->
    <Nullable Condition="'$(Nullable)' == '' and '$(IsTestProject)' != 'true'">enable</Nullable>
    <Nullable Condition="'$(Nullable)' == '' and '$(IsTestProject)' == 'true'">annotations</Nullable>
    <!-- EnableAOTAnalyzer is enabled by default for src projects. -->
    <EnableAOTAnalyzer Condition="'$(EnableAOTAnalyzer)' == '' and '$(IsSourceProject)' == 'true'">true</EnableAOTAnalyzer>
  </PropertyGroup>

  <!-- Set up common paths -->
  <PropertyGroup>
    <!-- Helix properties -->
    <OSPlatformConfig>$(TargetOS).$(Platform).$(Configuration)</OSPlatformConfig>
    <TestArchiveRoot>$(ArtifactsDir)helix/</TestArchiveRoot>
    <TestArchiveTestsRoot Condition="$(IsFunctionalTest) != true">$(TestArchiveRoot)tests/</TestArchiveTestsRoot>
    <TestArchiveTestsRoot Condition="$(IsFunctionalTest) == true">$(TestArchiveRoot)runonly/</TestArchiveTestsRoot>
    <TestArchiveTestsRoot Condition="'$(Scenario)' == 'BuildWasmApps'">$(TestArchiveRoot)buildwasmapps/</TestArchiveTestsRoot>
    <TestArchiveTestsDir>$(TestArchiveTestsRoot)$(OSPlatformConfig)/</TestArchiveTestsDir>
    <TestArchiveRuntimeRoot>$(TestArchiveRoot)runtime/</TestArchiveRuntimeRoot>

    <UseAppBundleRootForBuildingTests Condition="'$(ArchiveTests)' == 'true' and '$(BuildTestsOnHelix)' != 'true' and '$(TargetsAppleMobile)' == 'true'">true</UseAppBundleRootForBuildingTests>
    <AppBundleRoot Condition="'$(UseAppBundleRootForBuildingTests)' == 'true'">$(ArtifactsDir)bundles\</AppBundleRoot>

    <CommonPathRoot>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'Common'))</CommonPathRoot>
    <CommonPath>$([MSBuild]::NormalizeDirectory('$(CommonPathRoot)', 'src'))</CommonPath>
    <CommonTestPath>$([MSBuild]::NormalizeDirectory('$(CommonPathRoot)', 'tests'))</CommonTestPath>
  </PropertyGroup>

  <ItemGroup Condition="'$(IsTestProject)' == 'true' and '$(SkipTestUtilitiesReference)' != 'true'">
    <ProjectReference Include="$(CommonTestPath)TestUtilities\TestUtilities.csproj" />
  </ItemGroup>

  <PropertyGroup Condition="'$(IsTestProject)' == 'true'">
    <EnableTestSupport>true</EnableTestSupport>
    <!-- TODO: Remove these conditions when VSTest is used in CI. -->
    <EnableRunSettingsSupport Condition="'$(ContinuousIntegrationBuild)' != 'true'">true</EnableRunSettingsSupport>
    <EnableCoverageSupport Condition="'$(ContinuousIntegrationBuild)' != 'true'">true</EnableCoverageSupport>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TestReadyToRun)' == 'true'">
    <UseLocalAppHostPack>true</UseLocalAppHostPack>
  </PropertyGroup>

  <!-- To enable the interpreter for mono desktop, we need to pass an env switch -->
  <PropertyGroup>
    <MonoEnvOptions Condition="'$(MonoEnvOptions)' == '' and '$(TargetsMobile)' != 'true' and '$(MonoForceInterpreter)' == 'true'">--interpreter</MonoEnvOptions>
  </PropertyGroup>

  <Import Project="$(RepositoryEngineeringDir)testing\tests.props" Condition="'$(EnableTestSupport)' == 'true'" />

  <!-- Use msbuild path functions as that property is used in bash scripts. -->
  <ItemGroup>
    <CoverageExcludeByFile Include="$([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'Common', 'src', 'System', 'SR.*'))" />
    <CoverageExcludeByFile Include="$([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'Common', 'src', 'System', 'NotImplemented.cs'))" />
    <!-- Link to the testhost folder to probe additional assemblies. -->
    <CoverageIncludeDirectory Include="shared\Microsoft.NETCore.App\$(ProductVersion)" />
  </ItemGroup>

</Project>
